package net.xdclass.common.exception;

import lombok.Data;
import net.xdclass.common.enums.BizCodeEnum;

/**
 * 全局异常处理
 */
@Data
public class BizException extends RuntimeException{
    private Integer code;
    private String message;

    public BizException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BizException(String message, Throwable cause){
        super(message, cause);
    }

    public BizException(String message) {
        this.message = message;
    }

    public BizException(BizCodeEnum bizCodeEnum) {
        super(bizCodeEnum.getMessage());
        this.code = bizCodeEnum.getCode();
        this.message = bizCodeEnum.getMessage();
    }
}
